<template>
	<el-card>
		<el-form :inline="true" :model="state.queryForm" @keyup.enter="getDataList()">
			<el-form-item>
				<el-input v-model="state.queryForm.patientName" placeholder="请输入患者姓名" clearable></el-input>
			</el-form-item>
			<el-form-item>
				<el-button @click="getDataList()">查询</el-button>
			</el-form-item>
		</el-form>
		<el-table v-loading="state.dataListLoading" :data="state.dataList" border style="width: 100%" @selection-change="selectionChangeHandle">
			<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
			<el-table-column prop="patientName" label="患者姓名" header-align="center" align="center"></el-table-column>
			<el-table-column prop="deptName" label="住院部" header-align="center" align="center"></el-table-column>
			<el-table-column prop="nurseName" label="主管护士" header-align="center" align="center"></el-table-column>
			<el-table-column prop="bedName" label="床位信息" header-align="center" align="center"></el-table-column>
			<el-table-column prop="createTime" label="住院时间" header-align="center" align="center"></el-table-column>
			<el-table-column label="操作" fixed="right" header-align="center" align="center" width="150">
				<template #default="scope">
					<el-button type="primary" link @click="BatchHandleView(scope.row)">查看</el-button>
				</template>
			</el-table-column>
		</el-table>
		<el-pagination
			:current-page="state.page"
			:page-sizes="state.pageSizes"
			:page-size="state.limit"
			:total="state.total"
			layout="total, sizes, prev, pager, next, jumper"
			@size-change="sizeChangeHandle"
			@current-change="currentChangeHandle"
		>
		</el-pagination>
		<!-- 弹窗, 新增 / 修改 -->
		<AddOrUpdate ref="listUserRef"></AddOrUpdate>
	</el-card>
</template>

<script setup lang="ts" name="SysPostIndex">
import { useCrud } from '@/hooks'
import { reactive, ref } from 'vue'
import AddOrUpdate from './housepatientAdd.vue'
import { IHooksOptions } from '@/hooks/interface'
const state: IHooksOptions = reactive({
	dataListUrl: '/sys/housepatient/page',
	deleteUrl: '/sys/housepatient',
	queryForm: {
		patientName: '',
		orgId:localStorage.getItem('org')
	}
})

const listUserRef = ref()
const BatchHandleView=(row:any)=>{
	listUserRef.value.init(row);
}
const { getDataList, selectionChangeHandle, sizeChangeHandle, currentChangeHandle, deleteBatchHandle } = useCrud(state)
</script>
